home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / progjour / 1988 / 01 / listing1.c < prev    next >
Text File  |  1987-12-28  |  896b  |  26 lines

  1.  /*
  2.   * gettime.c  --    Uses BIOS interrupt 0x1A to get the timer count 
  3.   *                  in clock ticks.
  4.   *   Copyright Frank D. Greco, 1987
  5.   *   Page 50, Volume 6.1 Programmer's Journal
  6.   */
  7.   
  8.   #include <dos.h>
  9.   
  10.   #define     TOD_INT     0x1a
  11.   
  12.   unsigned long gettime()
  13.   {
  14.       union REGS in, out;
  15.       unsigned long current_tix;      /* 32-bit tick value to be returned */
  16.   
  17.       in.h.ah = 0;                    /* AH = 0    GET clock ticks */
  18.       int86(TOD_INT, &in, &out);      /* Call BIOS timer tick interrupt */ 
  19.   
  20.       current_tix = ( (long) out.x.cx << 16 ) + out.x.dx;
  21.   
  22.   /* If midnite passes, add a day's worth of clock tix to the return value */
  23.   
  24.       return ( out.x.ax & 0xff ) ? current_tix += 0x01800b0L: current_tix;
  25.   }
  26.